from docs_class import Docs

def init ( l, admin = 0 ):
	from liwe import parts

	l.layman.add_js ( "modules/docs/js/docs.js" )
	l.layman.add_css ( "modules/docs/gfx/docs.css" )

	l.layman.add_js_code ( "docs.init();" )

	parts.add ( l.layman, [ "base", "form" ] )
	parts.add_wwl ( l.layman, [ "htmled", "calendar", "tabs", "tree" ] )

	if admin and int ( admin ):
		l.layman.add_css ( "modules/docs/gfx/docs.admin.css" )
		l.layman.add_js ( "modules/docs/js/docs.admin.js" )
		l.layman.add_js_code ( "docs.admin.init();" )

	return ''


def dump_node ( liwe, title, parent_id ):
	return { "title": title, "parent_id": parent_id }

def dump_html_tree ( liwe, section ):
	d = Docs ( liwe )

	return { "_txt" : d.dump_html_tree ( section ) }

def print_node ( liwe, mode, default_node ):
	d = Docs ( liwe )

	return { "_txt" : d.print_node ( mode, default_node ) }

